package com.pan.note.config;

import com.pan.note.message.NettyWebSocketServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

@Component
public class NettyInitConfig implements ApplicationListener<ApplicationReadyEvent> {

    @Autowired
    private NettyWebSocketServer nettyWebSocketServer;

    @Override
    public void onApplicationEvent(ApplicationReadyEvent event) {
        new Thread(nettyWebSocketServer).start();
    }
}
